﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:vm="clr-namespace:XtremeMvvm;assembly=XtremeMvvm"
        xmlns:this="clr-namespace:SampleView;assembly=SampleClient"
        mc:Ignorable="d" 
        d:DesignHeight="300" d:DesignWidth="368" SizeToContent="WidthAndHeight">
    <Window.CommandBindings>
        <CommandBinding Command="{x:Static this:RoutedCommands.SaveCustomer}" CanExecute="{vm:GetDelegate Save_CanExecute}"
            Executed="{vm:GetDelegate SaveCustomer}"/>
    </Window.CommandBindings>
    <Grid x:Name="LayoutRoot" Background="White" Height="150" Width="300" 
          DataContext="{Binding Source={vm:GetViewModel}}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Label Content="Customer Id:" Grid.Row="0" />
        <TextBox Grid.Row="0" Grid.Column="1" Height="30"
                 Text="{Binding Path=CurrentCustomer.Id, UpdateSourceTrigger=PropertyChanged}" />
        <Label Content="Customer Name:" Grid.Row="1" />
        <TextBox Grid.Row="1" Grid.Column="1" Height="30"
                 Text="{Binding Path=CurrentCustomer.Name, UpdateSourceTrigger=PropertyChanged}" />
        <Label Content="Customer City:" Grid.Row="2" />
        <TextBox Grid.Row="2" Grid.Column="1" Height="30"
                 Text="{Binding Path=CurrentCustomer.City}" />
        <Button Content="New Customer" Grid.Row="3" Grid.Column="0" 
                Height="30" Width="100" Click="{vm:GetDelegate NewCustomer}"/>
        <Button Content="Save" Grid.Row="3" Grid.Column="1"
                Height="30" Width="100" Command="{x:Static this:RoutedCommands.SaveCustomer}" />
        <Label VerticalAlignment="Center" Content="Quantity Saved:" Grid.Column="0" Grid.Row="4"/>
        <TextBlock VerticalAlignment="Center" Grid.Column="1" Grid.Row="4" Text="{Binding Source={vm:GetViewModel}, Path=QuantitySaved}" />
    </Grid>
</Window>
